const express = require('express')
const { getAll, getOne, exec } = require('../db')
//创建router路由对象
const router = express.Router()

router.put('/', async (req, res) => {
  const { username, email, personNote, pass, id } = req.body
  let sql = `update blog_user set username='${username}',email='${email}',personNote='${personNote}',password='${pass}' where id = ${id} `
  await exec(sql)
  res.send({
    code: 0,
    message: '更新用户信息成功,请重新登录',
  })
})

module.exports = router
